package dp;

public class _64 {
    public static void main(String[] args) {
        
    }
    public int rob(int[] nums) {
        int n=nums.length;
        int all1=0;
        int all2=0;
        for(int i=0;i<n;){
            if(i+2<n)
            all1+=nums[i+=2];
        }
        for(int i=1;i<n;){
            if(i+2<n)
            all2+=nums[i+=2];
        }
        return Math.max(all1, all2);
}
}
